#ifndef WATCHER_H
#define WATCHER_H

#include <QtNetwork>
#include <QObject>
#include <QTimer>
#include "SqlInterface.h"
#include "Event.h"

class Watcher : public QObject
{
    Q_OBJECT
public:
    Watcher();
    void start();

private:
    QString ipAddress() const;

    QTimer m_timer;
    EventList_t m_events;
    EventList_t m_notifiedEvents;
    QTcpSocket m_tcpSocket;
    QString currentFortune;
    QNetworkSession *networkSession;

public slots:
    bool checkEvent();
    void sendNotify();
    void displayError(QAbstractSocket::SocketError socketError);
    void sessionOpened();
};

#endif // WATCHER_H
